package com.example.aigc_education.enums;

import lombok.Getter;

@Getter
public enum PaperDifficultyType {



    // 难度，取值“basic(基础)”“easy(简单)”“middle(中等)”“hard(较难)”“extreme(极难)”

    BASIC("基础",0),
    BASIC_ENG("basic",0),
    EASY("简单",1),
    EASY_ENG("easy",1),
    MIDDLE("中等",2),
    MIDDLE_ENG("middle",2),
    HARD("困难",3),
    HARD_ENG("hard",3),
    EXTREME("极难",4),
    EXTREME_ENG("extreme",4);

    private final String title;

    private final Integer value;

    PaperDifficultyType(String title, Integer value) {
        this.title = title;
        this.value = value;
    }

    public static PaperDifficultyType fromValue(Integer value) {
        for (PaperDifficultyType paperDifficultyType : PaperDifficultyType.values()) {
            if (paperDifficultyType.getValue().equals(value)) {
                return paperDifficultyType;
            }
        }
        throw new IllegalArgumentException("No enum constant with value " + value);
    }

    public static PaperDifficultyType fromTitle(String title) {
        for (PaperDifficultyType paperDifficultyType : PaperDifficultyType.values()) {
            if (paperDifficultyType.getTitle().equals(title)) {
                return paperDifficultyType;
            }
        }
        throw new IllegalArgumentException("No enum constant with title " + title);
    }
}
